home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sounds Terrific 2
/
Sounds Terrific II (1996)(Weird Science)(Disc 2 of 2)[Amiga-PC].iso
/
midcraft
/
midutil1
/
m2midi
/
midisupport.mod
< prev
next >
Wrap
Text File
|
1991-04-13
|
2KB
|
69 lines
(***************************************************************************
:Program. MidiSupport.mod
:Author. Jⁿrgen Zimmermann
:Address. Ringstra▀e 6, W-6719 Altleiningen, Germany
:Phone. 06356/1456
:ShortCut. [JnZ]
:Support. -
:Version. 1.1
:Date. 8. May 1991
:Copyright. PD
:Language. MODULA-2
:Translator. M2Amiga 4.0d
:Contents. Modula-2-implementation of the original "C-Midi-Macros"
:Contents. "midi.library" of Fish 227, c-functions in "MidiSupport"!
:Imports. "midi.library" V2.0 in the LIBS:-directory
:Remark. I want to get into contact with other users of the
:Remark. "midi.library" or MIDI-programmers.
:Remark. (If you have a new version of the library, please send
:Remark. it to me!)
:Usage. described in the documents of "midi.library"
****************************************************************************)
IMPLEMENTATION MODULE MidiSupport;
PROCEDURE MidiHiByte(data: CARDINAL): SHORTCARD;
(* pack high bytes of a word into midi format (7/14 bit math) *)
BEGIN
RETURN (SHORTCARD(data DIV 128));
END MidiHiByte;
PROCEDURE MidiLoByte(data: CARDINAL): SHORTCARD;
(* pack low bytes of a word into midi format (7/14 bit math) *)
BEGIN
RETURN (SHORTCARD(data MOD 128));
END MidiLoByte;
PROCEDURE MidiWord(hi,lo: SHORTCARD): CARDINAL;
(* unpack 2 midi bytes into a word (7/14 bit math) *)
BEGIN
RETURN (CARDINAL(hi) * 128 + CARDINAL(lo));
END MidiWord;
PROCEDURE SplitMidiID( id : LONGCARD;
VAR id0,id1,id2: SHORTCARD);
(* unpack a 3 byte sys/ex id into single bytes for argument
lists and RIMatch initializers *)
BEGIN
id0:=(SHORTCARD(id DIV 65536));
id1:=(SHORTCARD((id DIV 256) MOD 256));
id2:=(SHORTCARD(id MOD 256));
END SplitMidiID;
PROCEDURE MakeMidiID(id0,id1,id2: SHORTCARD): LONGCARD;
(* make a 3 byte sys/ex id from three single bytes *)
BEGIN
RETURN ((LONGCARD(id0) * 65536) + (LONGCARD(id1) * 256) + LONGCARD(id2));
END MakeMidiID;
END MidiSupport.